home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 2002 November / SGI Freeware 2002 November - Disc 1.iso / dist / fw_apache2.idb / usr / freeware / apache2 / include / pcreposix.h.z / pcreposix.h
C/C++ Source or Header  |  2002-07-08  |  2KB  |  90 lines

  1. /*************************************************
  2. *       Perl-Compatible Regular Expressions      *
  3. *************************************************/
  4.  
  5. /* Copyright (c) 1997-2000 University of Cambridge */
  6.  
  7. /**
  8.  * @file include/pcreposix.h
  9.  * @brief PCRE definitions
  10.  */
  11.  
  12. #ifndef _PCREPOSIX_H
  13. #define _PCREPOSIX_H
  14.  
  15. /* This is the header for the POSIX wrapper interface to the PCRE Perl-
  16. Compatible Regular Expression library. It defines the things POSIX says should
  17. be there. I hope. */
  18.  
  19. /* Have to include stdlib.h in order to ensure that size_t is defined. */
  20.  
  21. #include <stdlib.h>
  22.  
  23. /* Allow for C++ users */
  24.  
  25. #ifdef __cplusplus
  26. extern "C" {
  27. #endif
  28.  
  29. /* Options defined by POSIX. */
  30.  
  31.   /** Ignore case */
  32. #define REG_ICASE     0x01
  33.   /** Don't match newlines with wildcards */
  34. #define REG_NEWLINE   0x02
  35.   /** Don't match BOL */
  36. #define REG_NOTBOL    0x04
  37.   /** Don't match EOL */
  38. #define REG_NOTEOL    0x08
  39.  
  40. /* These are not used by PCRE, but by defining them we make it easier
  41. to slot PCRE into existing programs that make POSIX calls. */
  42.  
  43.   /** UNUSED! */
  44. #define REG_EXTENDED  0
  45.   /** UNUSED! */
  46. #define REG_NOSUB     0
  47.  
  48. /* Error values. Not all these are relevant or used by the wrapper. */
  49.  
  50. enum {
  51.   REG_ASSERT = 1,  /* internal error ? */
  52.   REG_BADBR,       /* invalid repeat counts in {} */
  53.   REG_BADPAT,      /* pattern error */
  54.   REG_BADRPT,      /* ? * + invalid */
  55.   REG_EBRACE,      /* unbalanced {} */
  56.   REG_EBRACK,      /* unbalanced [] */
  57.   REG_ECOLLATE,    /* collation error - not relevant */
  58.   REG_ECTYPE,      /* bad class */
  59.   REG_EESCAPE,     /* bad escape sequence */
  60.   REG_EMPTY,       /* empty expression */
  61.   REG_EPAREN,      /* unbalanced () */
  62.   REG_ERANGE,      /* bad range inside [] */
  63.   REG_ESIZE,       /* expression too big */
  64.   REG_ESPACE,      /* failed to get memory */
  65.   REG_ESUBREG,     /* bad back reference */
  66.   REG_INVARG,      /* bad argument */
  67.   REG_NOMATCH      /* match failed */
  68. };
  69.  
  70.  
  71. /* The structure representing a compiled regular expression. */
  72.  
  73. typedef struct {
  74.   void *re_pcre;
  75.   size_t re_nsub;
  76.   size_t re_erroffset;
  77. } regex_t;
  78.  
  79. /* The structure in which a captured offset is returned. */
  80.  
  81. typedef int regoff_t;
  82.  
  83. typedef struct {
  84.   regoff_t rm_so;
  85.   regoff_t rm_eo;
  86. } regmatch_t;
  87.  
  88. /* The functions */
  89.  
  90. extern int regcomp(regex_t *, cons